#!/usr/bin/perl

#eqstatus.pl
#By:Ronny L. Bull (aka. Cubber)
#Script to print out information about the eqemu server
#Uses Net::Telnet module
#11-25-2009

#Note: The telnet server must be enabled for this script to work


use strict;
use warnings;
use Net::Telnet();

my $i;
my $telnet;

$telnet = new Net::Telnet (Timeout=>10, Port=>'9000', Prompt=>'/\> $/');

#Change the following to reflect your setup
$telnet->open("SERVER_IP");
$telnet->login("USER", "PASS");
#NO MORE CHANGES PAST HERE!!

&Version;
&Uptime;
&Who;
&Zones;
exit;

sub Version()

{

my @version;

@version = $telnet->cmd("version");
my $vercnt = $#version;

for($i=1;$i<$vercnt;$i++)
	{
		print $version[$i];
	}

print "\n";

}


sub Uptime()

{

my @uptime;

@uptime =  $telnet->cmd("uptime");
print $uptime[1];
print "\n";

}


sub Who()

{

my @who;

@who = $telnet->cmd("who");
my $whocnt = $#who;

for($i=1;$i<$whocnt;$i++)
	{
		print $who[$i];
	}

print "\n";

}

sub Zones()

{

my @zones = $telnet->cmd("zonestatus");
my $zonecnt = $#zones;

for($i=1;$i<$zonecnt;$i++)
	{
		print $zones[$i];
	}

print "\n";

}
